package org.bsc.mgwt.client.widget.explorer;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HasWidgets;
import com.googlecode.mgwt.mvp.client.AnimatableDisplay;
import com.googlecode.mgwt.ui.client.MGWTStyle;
import com.googlecode.mgwt.ui.client.widget.LayoutPanel;

/**
 * 
 * @author softphone
 *
 */
public class MVPExplorerPanel extends Composite {

	public interface Css extends CssResource {

		@ClassName("mgwt-explorerPanel")
		String panel();
		
		String left();
		
		String right();
	}

	private LayoutPanel container;
	private final LayoutPanel leftWidget ;
	private FlowPanel aniContainer;
	
	private final AnimatableDisplay animatableDisplay;
	
	/**
	 * 
	 */
	public MVPExplorerPanel( Css css ) {
		this( css, (AnimatableDisplay)GWT.create(AnimatableDisplay.class) );
	}

	/**
	 * 
	 * @param activityMapper
	 * @param display
	 */
	public MVPExplorerPanel( Css css, final AnimatableDisplay display ) {
		css.ensureInjected();
		this.animatableDisplay = display;
		
		container = new LayoutPanel();
		
		container.addStyleName(MGWTStyle.getTheme().getMGWTClientBundle().getLayoutCss().fillPanelExpandChild());
		container.addStyleName(css.panel());
		
		container.setHorizontal(true);
		
		leftWidget = new LayoutPanel();
		leftWidget.addStyleName(css.left());
		
		aniContainer = new FlowPanel();
		
		// TODO
		aniContainer.getElement().getStyle().setPosition(Position.RELATIVE);

		aniContainer.addStyleName(MGWTStyle.getTheme().getMGWTClientBundle().getLayoutCss().fillPanelExpandChild());
		aniContainer.addStyleName(css.right());

		aniContainer.add(animatableDisplay);
		
		container.add( leftWidget );
		container.add( aniContainer	);
		
		
		initWidget(container);
	}

	public HasWidgets getLeftWidget() {
		return leftWidget;
	}

	public final AnimatableDisplay getAnimatableDisplay() {
		return animatableDisplay;
	}


	
}
